package p270jp.pxv.android.event;

import android.content.Context;
import java.util.Locale;
import p270jp.pxv.android.R;
import p270jp.pxv.android.legacy.model.PixivIllust;
import p270jp.pxv.android.legacy.model.PixivNovel;
import p270jp.pxv.android.legacy.model.PixivWork;

/* renamed from: jp.pxv.android.event.ShareWorkEvent */
/* loaded from: classes2.dex */
public class ShareWorkEvent {
    private static final String TITLE_FORMAT = "%s | %s #pixiv";
    private static final String URL_FORMAT_NOVEL = "https://www.pixiv.net/novel/show.php?id=%d";
    private String shareBody;

    public ShareWorkEvent(PixivWork pixivWork, Context context) {
        this.shareBody = getTitle(pixivWork) + " " + getUrl(pixivWork, context);
    }

    private String getTitle(PixivWork pixivWork) {
        return String.format(TITLE_FORMAT, pixivWork.title, pixivWork.user.name);
    }

    private String getUrl(PixivWork pixivWork, Context context) {
        if (pixivWork instanceof PixivIllust) {
            return context.getString(R.string.share_artwork_url_format, Long.valueOf(pixivWork.f19079id));
        }
        return pixivWork instanceof PixivNovel ? String.format(Locale.US, URL_FORMAT_NOVEL, Long.valueOf(pixivWork.f19079id)) : "";
    }

    public String getShareBody() {
        return this.shareBody;
    }
}
